home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Utilities / DreamCDGuide / sources / demo.h next >
C/C++ Source or Header  |  2000-04-11  |  3KB  |  170 lines

  1. /*************************************************************/
  2. /* Includes and other common stuff for the MUI demo programs */
  3. /*************************************************************/
  4.  
  5. /* MUI */
  6. #include <libraries/mui.h>
  7.  
  8. /* System */
  9. #include <dos/dos.h>
  10. /* moi */
  11.  
  12. #include <graphics/gfxmacros.h>
  13. #include <workbench/workbench.h>
  14. /* Rajouté par moi... */
  15. #include <exec/types.h>
  16. #include <exec/memory.h>
  17. #include <exec/exec.h>
  18. #include <intuition/intuition.h>
  19. /* fin */
  20.  
  21. /* Prototypes */
  22. #include <clib/alib_protos.h>
  23. #include <clib/exec_protos.h>
  24. #include <clib/dos_protos.h>
  25. #include <clib/icon_protos.h>
  26. #include <clib/graphics_protos.h>
  27. #include <clib/intuition_protos.h>
  28. #include <clib/gadtools_protos.h>
  29. #include <clib/utility_protos.h>
  30. #include <clib/asl_protos.h>
  31.  
  32. #ifndef __GNUC__
  33.    #include <clib/muimaster_protos.h>
  34. #else
  35.    #include <inline/muimaster.h>
  36. #endif
  37.  
  38. /* ANSI C */
  39. #include <stdlib.h>
  40. #include <string.h>
  41. #include <stdio.h>
  42.  
  43.  
  44. /* Compiler specific stuff */
  45. /*FR* StormC compability added by Fredrik Rambris */
  46.  
  47. #ifdef _DCC
  48.  
  49.    #define REG(x) __ ## x
  50.    #define ASM
  51.    #define SAVEDS __geta4
  52.  
  53. #else
  54.  
  55.    #define REG(x) register __ ## x
  56.  
  57.    #if defined __MAXON__ || defined __GNUC__
  58.       #define ASM
  59.       #define SAVEDS
  60.    #else
  61.       #ifdef __STORM__
  62.          #define ASM
  63.          #define __stdargs
  64.          #define __asm
  65.       #else
  66.          #define ASM    __asm
  67.       #endif /* if __STORM__ */
  68.       #define SAVEDS __saveds
  69.    #endif /* if defined */
  70.  
  71.  
  72.    #ifdef __SASC
  73.       #include <pragmas/exec_sysbase_pragmas.h>
  74.    #else
  75.       #ifndef __GNUC__
  76.          #include <pragmas/exec_pragmas.h>
  77.       #endif /* ifndef __GNUC__ */
  78.    #endif /* ifdef SASC      */
  79.  
  80.    #ifndef __GNUC__
  81.  
  82.       #include <pragmas/dos_pragmas.h>
  83.       #include <pragmas/icon_pragmas.h>
  84.       #include <pragmas/graphics_pragmas.h>
  85.       #include <pragmas/intuition_pragmas.h>
  86.       #include <pragmas/gadtools_pragmas.h>
  87.       #include <pragmas/utility_pragmas.h>
  88.       #include <pragmas/asl_pragmas.h>
  89.       #include <pragmas/muimaster_pragmas.h>
  90.  
  91.    #endif /* ifndef __GNUC__ */
  92.  
  93.    extern struct Library *SysBase,*IntuitionBase,*UtilityBase,*GfxBase,*DOSBase,*IconBase;
  94.    struct Library *MUIMasterBase;
  95.  
  96. #endif /* ifdef _DCC */
  97.  
  98.  
  99. /*************************/
  100. /* Init & Fail Functions */
  101. /*************************/
  102.  
  103. static VOID fail(APTR app,char *str)
  104. {
  105.         if (app)
  106.                 MUI_DisposeObject(app);
  107.  
  108. #ifndef _DCC
  109.         if (MUIMasterBase)
  110.                 CloseLibrary(MUIMasterBase);
  111. #endif
  112.  
  113.         if (str)
  114.         {
  115.                 puts(str);
  116.                 exit(20);
  117.         }
  118.         exit(0);
  119. }
  120.  
  121.  
  122. #ifdef _DCC
  123.  
  124. int brkfunc(void) { return(0); }
  125.  
  126. int wbmain(struct WBStartup *wb_startup)
  127. {
  128.         extern int main(int argc, char *argv[]);
  129.         return (main(0, (char **)wb_startup));
  130. }
  131.  
  132. #endif
  133.  
  134.  
  135. #ifdef __SASC
  136. int CXBRK(void) { return(0); }
  137. int _CXBRK(void) { return(0); }
  138. void chkabort(void) {}
  139. #endif
  140.  
  141.  
  142. static VOID init(VOID)
  143. {
  144. #ifdef _DCC
  145.         onbreak(brkfunc);
  146. #endif
  147.  
  148. #ifndef _DCC
  149.         if (!(MUIMasterBase = OpenLibrary(MUIMASTER_NAME,MUIMASTER_VMIN)))
  150.                 fail(NULL,"Failed to open "MUIMASTER_NAME".");
  151. #endif
  152. }
  153.  
  154.  
  155. #ifndef __SASC
  156. static VOID stccpy(char *dest,char *source,int len)
  157. {
  158.         strncpy(dest,source,len);
  159.         dest[len-1]='\0';
  160. }
  161. #endif
  162.  
  163.  
  164. #ifndef MAKE_ID
  165. #define MAKE_ID(a,b,c,d) ((ULONG) (a)<<24 | (ULONG) (b)<<16 | (ULONG) (c)<<8 | (ULONG) (d))
  166. #endif
  167.  
  168.  
  169. LONG __stack = 8192;
  170.